﻿//Popup Login
$(document).ready(function () {
    //Chỉ nhập số (number) vào input
    $(".number").keypress(function (e) {
        if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
            return false;
        }
    });
    //
    fncShowMenuLeft();
    fncSearchQuick();
    $('.btn-dangtin').click(function () {
        window.location.href = "/dang-tin";
    });
});
function fncSearchQuick() {
    $('#search_quick').click(function () {
        var strKeyWord = $('#txtKeyword').val();
        window.location.href = "/tim-kiem?q=" + strKeyWord;
    });
}
//
function fncShowMenuLeft() {
    $('.show-menu-left').click(function () {
        $('#menu-left').toggle("slide", { direction: "left" }, 100);
        //
        if ($('#headerbar').hasClass('hide')) {
            $('#headerbar').css("left", "0"); $('#headerbar').removeClass('hide');
        } else {
            $('#headerbar').css("left", "260px"); $('#headerbar').addClass('hide');
        }
        //
        if ($('.touchbody').hasClass('hide')) {
            $('.touchbody').css("margin-left", "0"); $('.touchbody').removeClass('hide');
        } else {
            $('.touchbody').css("margin-left", "260px"); $('.touchbody').addClass('hide');
        }
    });
}
/*=====================liblary function================================*/
jQuery.fn.errorItem = function (message) {
    $(this).addClass("error-item");
    $(this).attr("placeholder", message);
};
/*=====================================================================*/